﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace devtm.Types
{


    public class GlobalAssemblyCash
    {

        // item.processorArchitecture != "x86"

        private List<AssemblyDescription> _lst;

        public GlobalAssemblyCash()
        {

            AssemblyCacheEnum e = new AssemblyCacheEnum(null);

            _lst = new List<AssemblyDescription>();

            string name = e.GetNextAssembly();

            while (! string.IsNullOrEmpty(name))
            {

                AssemblyDescription _current = new AssemblyDescription(name);



                this._lst.Add(_current);

                name = e.GetNextAssembly();
            }

        }


        public IEnumerable<String> Level1()
        {
            return from j in _lst
                   group j by j.Level1 into h
                   select h.Key;
        }


        public IEnumerable<AssemblyDescription> Assemblies(string level1name)
        {
            return from j in _lst
                   where j.Level1 == level1name
                   select j;
        }


        public IEnumerable<AssemblyDescription> Assemblies()
        {
            return from j in _lst
                   select j;
        }


        

    }

}
